version: "3.8"

services:
  nginx:
    image: nginx:latest
    logging:
      driver: "json-file"
      options:
        max-size: "200k"
        max-file: "10"
    ports:
      - 8088:80
    volumes:
      - /etc/localtime:/etc/localtime:ro
    networks:
      - "default"  
    deploy:
      mode: replicated
      replicas: 1
      labels:
        - "traefik.enable=true"
        - "traefik.docker.network=default"
        - "traefik.http.services.nginx_nginx.loadbalancer.server.port=80"
        # http 80
        - "traefik.http.routers.nginx.rule=Host(`nginx.lcoalhost.com`)" 
        - "traefik.http.routers.nginx.entrypoints=web"
      placement:
        constraints: [node.role == manager]
      resources:
        limits:
          cpus: '0.50'
          memory: 50M
        reservations:
          cpus: '0.25'
          memory: 20M
      restart_policy:
        condition: on-failure
        delay: 5s
        max_attempts: 3
        window: 120s

networks:
  default:
    external:
      name: traefik_default